const { fstat } = require('fs');
const mfs = require('./mfs');
const utils = require('./utils');
function pack(config) {


    const packType = config.debug == "false" ? "Release" :"Debug";
    // const pack_apk = `cd ${config.buildPath}/frameworks/runtime-src/proj.android-studio && chmod 777 gradlew  && ./gradlew assemble${packType}`;
    const pack_apk = `cd ${config.nativePath}/frameworks/runtime-src/proj.android-studio && ./gradlew :${config.title}:assemble${packType}`// assemble${packType}`;
    utils.runShSync(pack_apk);
    // return new Promise((resolve, reject) => {
    //     utils.execFile('gradlew', [':' + config.title + ':assembleRelease'], { cwd: config.androidPath }, (error, stdout, stderr) => {
    //         if (error) {
    //             console.log('error', error);
    //             reject();
    //         } else {
    //             console.log('执行成功');
    //             resolve();
    //         }
    //     });
    // });
}

module.exports.pack = pack;

